import { defineStore } from 'pinia'
import { store } from '../index'

export const useMenuStore = defineStore({
  id: 'menu',
  state: ()=>({
    TelphoneAppeal:{
      pending:0,
      feedback:0,
      file:0,
      supervise:0,
      overdue:0,
      dispute:0,
      Archived:0,
      extension:0,
      invalid:0,
      all:0
    },
    NetworkAppeal:{
      pending:0,
      feedback:0,
      file:0,
      supervise:0,
      overdue:0,
      dispute:0,
      Archived:0,
      extension:0,
      invalid:0,
      all:0
    }
    
  }),
  persist: {
    enabled: true
  },
  getters: {
   
  },
  actions: {
    setBadge(menu,type,n){
        this[menu][type]=n;
    },
    getBadge(meta){ 
      const {mark,type,}=meta;  
      if(!this[mark])return 0;    
      if(!type||type=="all")return 0;
   
      return this[mark][type];
    }
  }
})

export const useMenuStoreWithOut = () => {
  return useMenuStore(store)
}
